import * as API from '@/api'

const state = {
  branchList: [],
};

// 获取state的数据
const getters = {
  branchList: (state) => state.branchList,
};

// 更新state的数据
const mutations = {
  BranchList(state, data) {
    state.branchList = data;
  },
};

// 更新state数据的动作
const actions = {
  async fetchBranchList({ commit }, params) {
    try {
      const res = await API.BranchList(params);
      res.forEach((item) => (item.checked = false));
      commit("BranchList", res);
    } catch (e) {
    }
  },
};

export default { state, getters, mutations, actions };
